package cn.ainit.sys.framework;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Service;

import cn.ainit.sys.ds.cloumns.sysCloumns;
import cn.ainit.sys.dz.entity.SysDzSource;
import cn.ainit.sys.framework.entity.ColnPerms;
import cn.ainit.sys.framework.entity.SysButtons;
import cn.ainit.sys.framework.entity.SysColumns;
import cn.ainit.sys.print.entity.SysPrint;
import cn.ainit.sys.query.datastore.DataStore;
import cn.ainit.sys.query.entity.QueryJson;

@Service("frameworkServiceImpl")
public class FrameworkServiceImpl implements FrameworkService {
	
	private FrameworkDao frameworkDao;
	
	@Resource
	public void setFrameworkDao(FrameworkDao frameworkDao) {
		this.frameworkDao = frameworkDao;
	}

	@Override
	public List<SysButtons> butnList(String butnId) throws Exception {
		return frameworkDao.butnList(butnId);
	}

	@Override
	public List<SysColumns> colList(String colId, String flag) throws Exception {
		return frameworkDao.colList(colId, flag);
	}
	
	@Override
	public Object queryRowsBySql(String sqlText) throws Exception {
		return frameworkDao.queryRowsBySql(sqlText);
	}
	@Override
	public DataStore getDataStoreById(String dsid) throws Exception {
		return frameworkDao.getDataStoreById(dsid);
	}
	@Override
	public boolean updateObject(String sqlText, String[] valuesArr,
			String[] whereValue) throws Exception {
		return frameworkDao.updateObject(sqlText,valuesArr,whereValue);
	}
	@Override
	public boolean execLink(String id, String otherParam) throws Exception {
		return frameworkDao.execLink(id, otherParam);
	}
	@Override
	public String getMaxPkStr(String sql) throws Exception {
		return frameworkDao.getMaxPkStr(sql);
	}
	@Override
	public boolean saveObject(String sqlText, String[] valuesArr)
			throws Exception {
		return frameworkDao.saveObject(sqlText, valuesArr);
	}
	@Override
	public QueryJson queryRowsBySqlPagination(String sqlText, int cpage,
			int rows) throws Exception {
		return frameworkDao.queryRowsBySqlPagination(sqlText, cpage,rows);
	}
	@Override
	public List loadColumnsU(String colId, String type, String flag,String uid)
			throws Exception {
		return frameworkDao.loadColumnsU(colId, type, flag,uid);
	}
	@Override
	public List execSql(String sql) throws Exception {
		return frameworkDao.execSql(sql);
	}
	@Override
	public String formatSql(String dsid,String sqlText, String uid) throws Exception {
		return frameworkDao.formatSql(dsid,sqlText,uid);
	}
	
	@Override
	public String formatRowSql(String dsid, String sqlText, String uid)
			throws Exception {
		return frameworkDao.formatRowSql(dsid,sqlText,uid);
	}

	@Override
	public List<SysPrint> printList(String dsId) throws Exception {
		return null;
	}
	
	@Override
	public List onlyOneCloumn(String colName, String dsId)
			throws Exception {
		return frameworkDao.onlyOneCloumn(colName, dsId);
	}
	@Override
	public List lowerColumns(String lowFlag,String dsId) throws Exception {
		return frameworkDao.lowerColumns(lowFlag,dsId);
	}
	
	@Override
	public List queryDftRowByDsId(String flag,String dsid, HttpSession session) throws Exception {
		return frameworkDao.queryDftRowByDsId(flag,dsid,session) ;
	}
	@Override
	public String execSqlForString(String sql) throws Exception {
		return frameworkDao.execSqlForString(sql);
	}
	@Override
	public SysDzSource sqlForList(String sql) throws Exception {
		return frameworkDao.sqlForList(sql);
	}

	@Override
	public List<SysColumns> loadMulColumns(String dsId) throws Exception {
		return frameworkDao.loadMulColumns(dsId);
	}

	@Override
	public SysColumns loadSysColumns(String dsid, String coluname)
			throws Exception {
		return frameworkDao.loadSysColumns(dsid, coluname);
	}

	@Override
	public List getMultiList(String dsId, String sinPkVal, String colName,
			String param1) throws Exception {
		return frameworkDao.getMultiList(dsId, sinPkVal, colName, param1);
	}

	@Override
	public String newSourceId(String dsId, String colName, String oldSourceId)
			throws Exception {
		return frameworkDao.newSourceId(dsId, colName, oldSourceId);
	}
	
	@Override
	public SysColumns queryColumnsMul(String dsid, String clnName)
			throws Exception {
		return frameworkDao.queryColumnsMul(dsid,clnName);
	}
	
	@Override
	public SysDzSource loadDzSource(String dzId) throws Exception {
		return frameworkDao.loadDzSource(dzId);
	}

	/***
	 * 根据单据id,判断单据是否设置修改的权限设置
	 * @param djId
	 * @param param
	 * @return
	 * @throws Exception
	 * @author feifei
	 * @date: 2015-4-7 下午04:15:37 
	 */
	@Override
	public String dbcModifyPerms(String djId,String dsId,HttpSession session,String param) throws Exception {
		return frameworkDao.dbcModifyPerms(djId, dsId, session, param);
	}

	/***
	 * 根据单据id,判断单据是否设置列修改的权限设置
	 * @param djId
	 * @param param
	 * @return
	 * @throws Exception
	 * @author feifei
	 * @date: 2015-4-7 下午04:15:37 
	 */
	@Override
	public ColnPerms dbcModifyColnPerms(String djId, String dsId,
			HttpSession session, String param) throws Exception {
		return frameworkDao.dbcModifyColnPerms(djId, dsId, session, param);
	}

	@Override
	public Map loadRightList(String funcId, String uid)
			throws Exception {
		return frameworkDao.loadRightList(funcId, uid);
	}
	
	@Override
	public String queryConditionSql(String dsId, String uid) {
		return frameworkDao.execQueryConditionSql(dsId,uid);
	}

	@Override
	public Map<String, List> loadAInfoList(String funcId, String uid,
			String djId) throws Exception {
		return frameworkDao.loadAInfoList(funcId, uid, djId);
	}
	public int getCntBySql(String sql){
		return frameworkDao.getCntBySql(sql);
	}
	
	@Override
	public Boolean recordOperateLog(String sql) throws Exception {
		return frameworkDao.recordOperateLog(sql);
	}
}
